//
//  WWPayAttentionModel.m
//  快医
//
//  Created by 张湾湾 on 16/7/6.
//
//

#import "WWPayAttentionModel.h"
#import "XHRNetworkingToolManager.h"
#import <MJExtension.h>
@implementation WWPayAttentionModel
+ (instancetype)modelWithDic:(NSDictionary *)dic{
    WWPayAttentionModel * model = [WWPayAttentionModel new];
    [model setValuesForKeysWithDictionary:dic];
    return model;
}

+ (void)attentionListsuccess:(void (^)(NSArray<WWPayAttentionModel *> *))successBlock error:(void (^)())errorBlock{
    
    //MARK: - 网络获取数据
    //MARK: - 不是json,也能兼容,可接受格式
    [XHRNetworkingToolManager shareManager].responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", nil];
    
    //MARK: - 请求的格式
    [XHRNetworkingToolManager shareManager].requestSerializer = [AFJSONRequestSerializer serializer];
    
        NSDictionary *paramDic = @{@"ci1_id":@1,
                               @"ci2_id":@3,
                               @"ci3_id":@3,
                               @"diagnosis_type":@0,
                               @"page_size":@15,
                               @"is_confirmed":@1,
                               @"user_id":@1000089,
                               @"page":@1,
                               @"has_diagnosis":@2
                               };
    
    
    [[XHRNetworkingToolManager shareManager]POST:@"http://iosapi.itcast.cn/matchDoctors.json.php" parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
            NSArray * tempArray = [WWPayAttentionModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"]];
        
        if (successBlock) {
            successBlock(tempArray);
        }
        
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"关注医生error");
    }];
    
    
}
@end
